<template>
  <view>
    <block v-if="list.length > 0">
        <goods-item v-for="item in list" :key="item.id" :item="item"></goods-item>
    </block>
    <block v-else>
      <u-empty
              mode="message"
              marginTop="140"
              icon="../../static/不存在@2x.png"
      >
      </u-empty>
    </block>
  
  </view>
</template>

<script>
  export default {
    name: 'GoodsList',
    components: {},
    props:{
      status:{
        type:String,
        default:"1"
      }
    },
    watch:{
      "status":{
       async handler(val){
          try{
            const {data:{data:{counts,items}}} = await uni.$u.http.get('/tasks/list',  {params:{status:val,...this.pageInfo}})
            this.count = counts
            this.list = items
            console.log(items)
          }catch(e){
            console.log(e)
          }
        },
          immediate:true
      }
    },
    data() {
      return {
        list:[],
        count:0,
        pageInfo:{
          page:'1',
          pageSize:'10'
        }
      };
    },
    async created(){

    },
    mounted(){
    },
    async onLoad(){
    },
    methods: {
      
    }
  }
</script>

<style lang="scss">
 
</style>